package com.weetop.cfw.mine.adapter

import android.widget.TextView
import com.blankj.utilcode.util.SpanUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.coorchice.library.SuperTextView
import com.weetop.cfw.R
import com.weetop.cfw.bean.AudioVideoBrowsingRecordBean
import com.weetop.cfw.bean.TestBean
import com.weetop.cfw.constants.UrlConstants


/**
 * 云课程列表适配器
 */
class CloudCurriculumAdapter(layoutId:Int,dataList:List<AudioVideoBrowsingRecordBean.DataBean>):BaseQuickAdapter<AudioVideoBrowsingRecordBean.DataBean,BaseViewHolder>(layoutId,dataList) {


    override fun convert(helper: BaseViewHolder, item: AudioVideoBrowsingRecordBean.DataBean?) {
        val textMyCoursesImg = helper.getView<SuperTextView>(R.id.textMyCoursesImg)
        val textCurrentPrice = helper.getView<TextView>(R.id.textCurrentPrice)
        val textOriginPrice = helper.getView<TextView>(R.id.textOriginPrice)
        if(item != null) {
            SpanUtils.with(textCurrentPrice).append("￥").setFontSize(12, true).append(item.sprice).create()
            SpanUtils.with(textOriginPrice).append("￥${item.mprice}").setStrikethrough().create()
        }
        textMyCoursesImg.setUrlImage("${UrlConstants.baseUrl}${item?.imgurl}")
        helper.setText(R.id.textCourseName,item?.title).setText(R.id.textCourseTeacherName,item?.author).setText(
            R.id.textCoursePlayNumber,item?.playnum)
    }


}